from django import forms

from planet.models import PlanetInfo
from constants import OUTPUT_CHOICES

# class InfiltrationForm(forms.Form):
#     fromplanet = forms.ModelChoiceField(label="Infiltration Planet ",queryset=None)
#     x_min = forms.IntegerField(label="X min ", widget=forms.TextInput(attrs={'size':'3'}))
#     y_min = forms.IntegerField(label="Y min ", widget=forms.TextInput(attrs={'size':'3'}))
#     x_max = forms.IntegerField(label="X max ", widget=forms.TextInput(attrs={'size':'3'}))
#     y_max = forms.IntegerField(label="Y max ", widget=forms.TextInput(attrs={'size':'3'}))
#     notag = forms.BooleanField(label="Only no-tag planets ", required=False)
#     agro = forms.BooleanField(label="Agro ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
#     minero = forms.BooleanField(label="Minero ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
#     techno = forms.BooleanField(label="Techno ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
#     
#     def __init__(self,player,*args, **kwargs):
#         super(InfiltrationForm, self).__init__(*args, **kwargs)
#         self.fields['fromplanet'].queryset = PlanetInfo.objects.filter(planet_owner=player).order_by('planet__name')

class PlanetSearch(forms.Form):
    
    alliance_tag = forms.CharField(label="Alliance ", required=False,max_length=5)
    #sc = forms.CharField(label="SC  ",)
    x_min = forms.IntegerField(label="X min ", required=False, widget=forms.TextInput(attrs={'size':'3'}))
    y_min = forms.IntegerField(label="Y min ", required=False, widget=forms.TextInput(attrs={'size':'3'}))
    x_max = forms.IntegerField(label="X max ", required=False, widget=forms.TextInput(attrs={'size':'3'}))
    y_max = forms.IntegerField(label="Y max ", required=False, widget=forms.TextInput(attrs={'size':'3'}))
    
    x = forms.IntegerField(label="X ", required=False, widget=forms.TextInput(attrs={'size':'3'}))
    y = forms.IntegerField(label="Y ", required=False, widget=forms.TextInput(attrs={'size':'3'}))
    distance = forms.IntegerField(label="Distance ", required=False, widget=forms.TextInput(attrs={'size':'3'}))
    
    agro = forms.BooleanField(label="Agro ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
    minero = forms.BooleanField(label="Minero ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
    techno = forms.BooleanField(label="Techno ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
    
    hyp = forms.BooleanField(label="Hyp. ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
    dict = forms.BooleanField(label="Dict. ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
    demo = forms.BooleanField(label="Demo. ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))
    auth = forms.BooleanField(label="Auth. ", required=False, widget=forms.CheckboxInput(attrs={'checked':'checked'}))

    output = forms.ChoiceField(label="Output ",choices = OUTPUT_CHOICES,widget=forms.RadioSelect())
